<script setup lang="ts">
import GoodsItem from '@components/GoodsItem.vue';
import {storeToRefs} from 'pinia';
import {useGlobalStore} from '@/store/global.ts';

const {goods} = storeToRefs(useGlobalStore());
</script>

<template>
    <div class="borrow">
        <h3>Hello</h3>
        <h3>欢迎使用物品借用~</h3>
        <van-button type="primary">主要按钮</van-button>
        <van-button type="success">成功按钮</van-button>
        <van-button type="default">默认按钮</van-button>
        <van-button type="warning">警告按钮</van-button>
        <van-button type="danger">危险按钮</van-button>
        <div class="container">
            <h3 class="title">长期物品</h3>
            <div class="box">
                <goods-item
                    v-for="item in goods"
                    :key="item"
                    :count="item.count"
                >
                    <template #name>{{ item.name }}</template>
                </goods-item>
            </div>
        </div>
        <div class="container">
            <h3 class="title">短期物品</h3>
            <div class="box">
                <goods-item
                    v-for="item in goods"
                    :key="item"
                    :count="item.count"
                >
                    <template #name>{{ item.name }}</template>
                </goods-item>
            </div>
        </div>
    </div>
</template>

<style scoped lang="less">
.borrow {
    width: 100vw;
    height: calc(100vh - var(--van-tabbar-height));
    padding: 20px;
    box-sizing: border-box;
    overflow-y: scroll;

    .container {
        display: flex;
        flex-direction: column;
        padding: 30px 0;
        margin-top: 30px;
        border-radius: 20px;
        background-color: #fff;

        .title {
            padding: 0 45px;
        }

        .box {
            border-radius: 10px;
            display: flex;
            flex-wrap: wrap;
        }
    }
}
</style>
